home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5960 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How to get a random string each time??
  5. Date: 22 Feb 96 01:21:52 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.824952112@rscernix>
  8. References: <4fh5od$qq0@news.nevada.edu> <4g4c5m$tlb@news.nevada.edu> <4gg4tj$s18@bcarh8ab.bnr.ca>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <4gg4tj$s18@bcarh8ab.bnr.ca> hwt@bnr.ca (Henry Troup) writes:
  13.  
  14. >In article <4g4c5m$tlb@news.nevada.edu>,
  15. >Clapton Chan <chancl@nevada.edu> wrote:
  16. >...
  17. >>     for(i=0; i<10; i++) {
  18. >...
  19. >>        if...
  20. >>           break;
  21. >>    }
  22. >> 
  23. >...
  24. >>    j = j%i;  /* this handles early program exit */
  25. >
  26. >I know a couple of people who would jump up and down and yell about
  27. >access to a loop index variable outside of the loop.  And I know a
  28. >language that made it impossible.
  29.  
  30. What language?  It was "illegal" in very old FORTRAN (pre-F77), but only
  31. if the DO-loop terminated normally (it was OK to use the loop index if
  32. the loop was left via a GO TO).
  33.  
  34. >I guess in C this is well defined, but it's still on my private list of
  35. >things not to do again.
  36.  
  37. Why?  It's a very convenient method to tell how the loop was terminated.
  38.  
  39. Dan
  40. --
  41. Dan Pop
  42. CERN, CN Division
  43. Email: danpop@mail.cern.ch 
  44. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  45.